/*
 * @Author: 星孑
 * @Date: 2021-11-09 16:51:07
 * @LastEditors: 星孑
 * @LastEditTime: 2022-04-12 16:25:11
 * @FilePath: /vue-template-web/src/router/index.js
 * @Description: 路由配置
 */
import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/views/layout/Layout'
import layoutLogin from '@/views/layoutLogin/layoutLogin'

export const defaultRoutes = [
  {
    path: '/login',
    component: layoutLogin,
    children: [
      {
        name: 'login',
        path: '/login',
        component: () => import('@/views/layoutLogin/components/login')
      }
    ],
    hidden: true
  },
  {
    path: '/',
    hidden: true,
    redirect: '/member/list'
  },
  {
    path: '',
    hidden: true,
    redirect: '/member/list'
  },
  {
    path: '/502',
    name: '502',
    component: () => import('@/views/Error/error502'),
    hidden: true
  }
]

export const asyncRoutes = [
  {
    path: '/member',
    component: Layout,
    redirect: '/member/list',
    name: 'member',
    meta: {
      title: '会员管理',
      icon: 'el-icon-user-solid'
    },
    children: [
      {
        path: 'list',
        name: 'member_list',
        meta: {
          title: '会员列表'
        },
        component: () => import('@/views/Member/list')
      },
      {
        path: 'detail',
        name: 'member_detail',
        hidden: true,
        meta: {
          showName: 'member_list',
          title: '会员详情'
        },
        component: () => import('@/views/Member/detail')
      }
    ]
  }
]

export default new Router({
  routes: defaultRoutes
})
